﻿@using SlamDunk.CMS.BLL
@using SlamDunk.CMS.Model
@using SlamDunk.CMS.Model.DataModel
@using SlamDunk.CMS.Model.ViewModel
@{
    //实例化业务层
    ArticleBll articleBll = new ArticleBll();
    ChannelBll channelBll = new ChannelBll();
    LinkBll linkBll = new LinkBll();
    PhotoAlbumBll albumBll = new PhotoAlbumBll();
    //广告位
    List<Link> adList = linkBll.GetModelList(12);
    Random random = new Random();
    //获取本科招生
    List<ArticleViewForRead> bachelorList = articleBll.GetModelList(9, 5).Select(x => x.ToViewModel()).ToList();
    Link bachelorImg = linkBll.GetModelList(6).FirstOrDefault() == null ? new Link() : linkBll.GetModelList(6).FirstOrDefault();
    Channel bachelorChannel = new Channel();
    if (bachelorList.Count > 0)
    {
        bachelorChannel = bachelorList[0].Channel;
    }
    //获取硕士招生
    List<ArticleViewForRead> masterList = articleBll.GetModelList(10, 5).Select(x => x.ToViewModel()).ToList();
    Link masterImg = linkBll.GetModelList(7).FirstOrDefault() == null ? new Link() : linkBll.GetModelList(7).FirstOrDefault();
    Channel masterChannel = new Channel();
    if (masterList.Count > 0)
    {
        masterChannel = masterList[0].Channel;
    }
    //获取暑期学校
    List<ArticleViewForRead> summerList = articleBll.GetModelList(22, 5).Select(x => x.ToViewModel()).ToList();
    Link summerImg = linkBll.GetModelList(8).FirstOrDefault() == null ? new Link() : linkBll.GetModelList(8).FirstOrDefault();
    Channel summerChannel = new Channel();
    if (summerList.Count > 0)
    {
        summerChannel = summerList[0].Channel;
    }
    //获取校友风采
    List<ArticleViewForRead> schFriendList = articleBll.GetModelList(17, 15).Select(x => x.ToViewModel()).ToList();
    schFriendList.ForEach(x =>
    {
        if (x.Content.Length <= 42)
        {
            x.Content = x.Content;
        }
        else
        {
            x.Content = x.Content.Substring(0, 41);
        }
    });
    Channel schFriendChannl = new Channel();
    if (schFriendList.Count > 0)
    {
        schFriendChannl = schFriendList[0].Channel;
    }
    //获取热点问题解答
    List<ArticleViewForRead> hotQList = articleBll.GetModelList(23, 9).Select(x => x.ToViewModel()).ToList();
    hotQList.ForEach(x =>
    {
        if (x.Title.Length <= 15)
        {
            x.Title = x.Title;
        }
        else
        {
            x.Title = string.Format("{0}...", x.Title.Substring(0, 11));
        }
    });
    Channel hotQChannel = new Channel();
    if (hotQList.Count > 0)
    {
        hotQChannel = hotQList[0].Channel;
    }
    //获取教授观点
    List<ArticleViewForRead> proViewList1 = articleBll.GetModelList(27, 1, 6).Select(x => x.ToViewModel()).ToList();
    List<ArticleViewForRead> proViewList2 = articleBll.GetModelList(27, 7, 12).Select(x => x.ToViewModel()).ToList();
    List<ArticleViewForRead> proViewList3 = articleBll.GetModelList(27, 13, 18).Select(x => x.ToViewModel()).ToList();
    Channel proViewChannel = new Channel();
    if (proViewList1.Count > 0)
    {
        proViewChannel = proViewList1[0].Channel;
    }
    //获取招生计划相关
    ArticleViewForRead enrollment = articleBll.GetModelList(26).FirstOrDefault() == null ? new ArticleViewForRead() { Url = "/" } : articleBll.GetModelList(26).FirstOrDefault().ToViewModel();
    Link recruitLink = linkBll.GetModelList(9).FirstOrDefault() == null ? new Link() : linkBll.GetModelList(9).FirstOrDefault();
    Link schlRecruitLink = linkBll.GetModelList(11).FirstOrDefault() == null ? new Link() : linkBll.GetModelList(11).FirstOrDefault();
    Channel recruitInfo = channelBll.GetModel(25) == null ? new Channel() : channelBll.GetModel(25);
    //获取视频在线
    ArticleViewForRead videoArt = articleBll.GetModelList(24, 1).FirstOrDefault() == null ? new ArticleViewForRead() { Channel = new Channel() } : articleBll.GetModelList(24, 1).FirstOrDefault().ToViewModel();
    //获取学院掠影
    List<PhotoAlbum> albumList = albumBll.GetModelList();
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@Model.Title</title>
    @Include("Head", Model)
</head>
<body>
    <!--广告位-->
    @for (int i = 0; i < adList.Count; i++)
    {
        <div id="div_float@{@i}" style="z-index:9999; width:176px; height:189px; overflow:hidden;"><a href="@adList[i].Url" target="_blank"><img src="@adList[i].ImagePath" width="176" height="189" /></a></div>
    }
    @Include("Top", Model)
    @Include("Banner", Model)
    <div class="Middlecon">
        <div class="Middle">
            <div class="Mid_L">
                <div class="Mid_ML2">
                    <!--本科招生-->
                    <div class="Mid_L1 l">
                        <div class="Mid_L1_tit">
                            <span class="Mid_L1title1 l">@bachelorChannel.ChannelName</span><span class="Mid_L1title2 l">Undergraduate Admissions</span><span class="Mid_L1title3 r"><a href="@bachelorChannel.GetUrl()">more</a></span>
                        </div>
                        <div class="Mid_L1_pic">
                            <a href="@bachelorChannel.GetUrl()">
                                <img src="@bachelorImg.ImagePath" width="336" height="118" alt="@bachelorChannel.ChannelName" />
                            </a>
                        </div>
                        <ul class="Mid_L1_txt">
                            @foreach (ArticleViewForRead article in bachelorList)
                            {
                                <li><a href="@article.Url">@article.Title</a></li>
                            }
                        </ul>
                    </div>
                    <!--研究生招生-->
                    <div class="Mid_L1 l">
                        <div class="Mid_L1_tit">
                            <span class="Mid_L1title1 l">@masterChannel.ChannelName</span><span class="Mid_L1title2 l">Graduate Admissions</span><span class="Mid_L1title3 r"><a href="@masterChannel.GetUrl()">more</a></span>
                        </div>
                        <div class="Mid_L1_pic">
                            <a href="@masterChannel.GetUrl()">
                                <img src="@masterImg.ImagePath" width="336" height="118" alt="@masterChannel.ChannelName" />
                            </a>
                        </div>
                        <ul class="Mid_L1_txt">
                            @foreach (ArticleViewForRead article in masterList)
                            {
                                <li><a href="@article.Url">@article.Title</a></li>
                            }
                        </ul>
                    </div>
                    <!--暑期学校-->
                    <div class="Mid_L1 l">
                        <div class="Mid_L1_tit">
                            <span class="Mid_L1title1 l">@summerChannel.ChannelName</span><span class="Mid_L1title2 l">Summer school</span><span class="Mid_L1title3 r"><a href="@summerChannel.GetUrl()">more</a></span>
                        </div>
                        <div class="Mid_L1_pic">
                            <a href="@summerChannel.GetUrl()">
                                <img src="@summerImg.ImagePath" width="336" height="118" alt="@summerChannel.ChannelName" />
                            </a>
                        </div>
                        <ul class="Mid_L1_txt">
                            @foreach (ArticleViewForRead article in summerList)
                            {
                                <li><a href="@article.Url">@article.Title</a></li>
                            }
                        </ul>
                    </div>
                </div>
                <!--校友风采-->
                <div class="Mid_ML3">
                    <div class="Mid_ML3_L4">
                        <div class="hd">
                            <span class="Mid_L1title1 l">@schFriendChannl.ChannelName</span><span class="Mid_L1title2 l">Schoolfellow Mien</span>
                            <span class="Mid_L1title4"> <span class="next"><a href="javascript:void(0)"></a></span><span class="prev"><a href="javascript:void(0)"></a></span></span>
                        </div>
                        <div class="bd">
                            <ul class="Mid_ML3_L4con">
                                @foreach (ArticleViewForRead article in schFriendList)
                                {
                                    <li>
                                        <a href="@article.Url" class="Mid_ML3_L4txtconin">
                                            <div class="Mid_ML3_L4pic">
                                                <img src="@article.ThumbPath" width="107" height="98" />
                                            </div>
                                            <div class="Mid_ML3_L4tit">@article.Title</div>
                                            <div class="Mid_ML3_L4txt">@article.Content</div>
                                        </a>
                                    </li>
                                }
                            </ul>
                        </div>
                    </div>
                    <script type="text/javascript">
                        jQuery(".Mid_ML3_L4").slide({ titCell: ".hd ul", mainCell: ".bd .Mid_ML3_L4con", autoPage: true, effect: "topLoop", autoPlay: true, vis: 8, trigger: "click" });
                    </script>
                </div>
                <div class="clear"></div>
            </div>
            <div class="Mid_R">
                <!--招生计划-->
                <a href="@recruitLink.Url" class="Mid_R3">
                    <img src="@recruitLink.ImagePath" width="250" height="88" />
                </a>
                <ul class="Mid_R1">
                    <li class="Mid_R1L1"><a href="@recruitInfo.GetUrl()"></a></li>
                    <li class="Mid_R1L2"><a href="@enrollment.Url"></a></li>
                    <li class="Mid_R1L3"><a href="@schlRecruitLink.Url"></a></li>
                    <li class="Mid_R1L4"><a href="/Html/ScoreLine/Index.html"></a></li>
                </ul>
                <!--视频在线-->
                <div class="Mid_R4">
                    <div class="Mid_R4_tit"><span class="Mid_R4_tit1">@videoArt.Channel.ChannelName</span><span class="Mid_R4_tit2">Video Online</span><a href="@videoArt.Channel.GetUrl()" class="Mid_R4_tit3">more</a></div>
                    <div class="Mid_R4_con">
                        <a href="@videoArt.Url" class="Mid_R4_con1">
                            <img src="@videoArt.ImagePath" width="218" height="126" />
                        </a>
                        <a href="@videoArt.Url" class="Mid_R4_con2">@videoArt.Title</a>
                    </div>
                </div>
                <!--热点问题解答-->
                <div class="Mid_R2">
                    <div class="Mid_R2_tit"><span class="Mid_R2_tit1">@hotQChannel.ChannelName</span><span class="Mid_R2_tit2">Problems to solve</span></div>
                    <div class="Mid_R2_txtcon">
                        <ul class="Mid_R2_txt1">
                            @foreach (ArticleViewForRead article in hotQList)
                            {
                                <li><a href="@article.Url">@article.Title</a></li>
                            }
                        </ul>
                        <div class="Mid_R2_txt2"><a href="@hotQChannel.GetUrl()" class="Mid_R2_txt21">查看更多解答 <span>>></span></a></div>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
            <!--教授观点-->
            <div class="Mid_L3">
                <div class="hd">
                    <div class="Mid_L3_tit1 l"><span class="Mid_L3_tit11">@proViewChannel.ChannelName</span><span class="Mid_L3_tit12">Professor view</span></div>
                    <span class="next"><a href="javascript:void(0)"></a></span>
                    <span class="prev"><a href="javascript:void(0)"></a></span>
                </div>
                <div class="bd">
                    <ul class="infoList">
                        <!--第一组-->
                        @if (proViewList1.Count > 0)
                        {
                            <li>
                                <ul class="Tist">
                                    @foreach (ArticleViewForRead article in proViewList1)
                                    {
                                        <li>
                                            <div class="Tist_pic">
                                                <a href="@article.Url"></a>
                                                <img src="@article.ThumbPath" width="92" height="86" />
                                            </div>
                                            <a href="@article.Url">
                                                <div class="Tist_titl"><span class="Tist_titl1">@article.Title</span><span class="Tist_titl2">@article.Author</span></div>
                                                <div class="Tist_txt">@article.Content</div>
                                            </a>
                                        </li>
                                    }
                                </ul>
                            </li>
                        }

                        <!--第二组-->
                        @if (proViewList2.Count > 0)
                        {
                            <li>
                                <ul class="Tist">
                                    @foreach (ArticleViewForRead article in proViewList2)
                                    {
                                        <li>
                                            <div class="Tist_pic">
                                                <a href="@article.Url"></a>
                                                <img src="@article.ThumbPath" width="92" height="86" />
                                            </div>
                                            <a href="@article.Url">
                                                <div class="Tist_titl"><span class="Tist_titl1">@article.Title</span><span class="Tist_titl2">@article.Author</span></div>
                                                <div class="Tist_txt">@article.Content</div>
                                            </a>
                                        </li>
                                    }
                                </ul>
                            </li>
                        }

                        <!--第三组-->
                        @if (proViewList3.Count > 0)
                        {
                            <li>
                                <ul class="Tist">
                                    @foreach (ArticleViewForRead article in proViewList3)
                                    {
                                        <li>
                                            <div class="Tist_pic">
                                                <a href="@article.Url"></a>
                                                <img src="@article.ThumbPath" width="92" height="86" />
                                            </div>
                                            <a href="@article.Url">
                                                <div class="Tist_titl"><span class="Tist_titl1">@article.Title</span><span class="Tist_titl2">@article.Author</span></div>
                                                <div class="Tist_txt">@article.Content</div>
                                            </a>
                                        </li>
                                    }
                                </ul>
                            </li>
                        }
                    </ul>
                </div>
            </div>
            <script type="text/javascript">
                jQuery(".Mid_L3").slide({ titCell: ".hd ul", mainCell: ".bd .infoList", autoPage: true, effect: "fold", autoPlay: true, scroll: 1, vis: 1, trigger: "click" });
            </script>
            <div class="clear"></div>
            <!--学院掠影-->
            <div class="Mid_B">
                <div class="hd">
                    <span class="Mid_Btit1 l">学院掠影</span><span class="Mid_Btit2 l">College Town</span>
                    <ul></ul>
                </div>
                <div class="bd">
                    <ul class="picList">
                        @foreach (PhotoAlbum album in albumList)
                        {
                            <li>
                                <div class="pic">
                                    <a href="/Html/Photo/Album-@{@album.Id}.html" target="_blank">
                                        <img src="@album.Cover" />
                                    </a>
                                </div>
                            </li>
                        }
                    </ul>
                </div>
            </div>
            <script type="text/javascript">
                jQuery(".Mid_B").slide({ titCell: ".hd ul", mainCell: ".bd ul", autoPage: true, effect: "leftLoop", autoPlay: true, scroll: 5, vis: 5, trigger: "click", pnLoop: false });
            </script>
        </div>
    </div>
    <div class="clear"></div>
    <script type="text/javascript" src="/Scripts/jquery_pf.js"></script>
    <script type="text/javascript">
        $(function () {
            @for (int i = 0; i < adList.Count; i++)
	        {
                <text>$('#div_float@{@i}').adFloat({ width: 176, height: 189, top: @random.Next(1, 200), left: @random.Next(1, 600) });</text>
	        }
        })
    </script>
    @Include("Foot", Model)
</body>
</html>
